<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>
<% String path = request.getContextPath(); %>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="<%=path%>/static/lib/html5shiv.js"></script>
<script type="text/javascript" src="<%=path%>/static/lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="<%=path%>/static/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="<%=path%>/static/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="<%=path%>/static/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="<%=path%>/static/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="<%=path%>/static/static/h-ui.admin/css/style.css" />
<!--[if IE 6]>
<script type="text/javascript" src="<%=path%>/static/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title></title>
<meta name="keywords" content="">
<meta name="description" content="">
</head>
<body>
<div class="page-container">
	<form class="form form-horizontal" id="formEdit" onsubmit="return false" action="##" method="post" >
		<c:if test="${type == '01'}">
			<div class="row cl">
				<label style="text-align: right;" class="form-label col-xs-4 col-sm-3">真实姓名：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input style="width: 190px;" type="text" style="width: 400px;" class="input-text" value="${user.realname}" placeholder="" id="realname" name="realname">
				</div>
			</div>
			<div class="row cl">
				<label style="text-align: right;" class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>学号：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input style="width: 190px;" disabled type="text" style="width: 400px;" class="input-text" value="${user.username}" placeholder="" id="username" name="username">
					<input type="hidden" style="width: 400px;" value="${user.id}"  name="id">
					<input type="hidden" style="width: 400px;" value="${user.username}"  name="username">
				</div>
			</div>
			<div class="row cl">
				<label style="text-align: right;" class="form-label col-xs-4 col-sm-3">手机：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input style="width: 190px;" type="text" style="width: 400px;" class="input-text" value="${user.phone}" placeholder="" id="phone" name="phone">
				</div>
			</div>
			<div class="row cl">
				<label style="text-align: right;" class="form-label col-xs-4 col-sm-3">出生年月：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input style="width: 190px;" type="text" style="width: 400px;" class="input-text" value="${user.birthday}" placeholder="" id="birthday" name="birthday">
				</div>
			</div>
			<div class="row cl">
				<label style="text-align: right;" class="form-label col-xs-4 col-sm-3">是否团员：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<select style="width: 190px;" class="select" size="1" name="red">
						<c:choose>
							<c:when  test="${user.red == '是'}">
								<option value="是" selected>是</option>
								<option value="否">否</option>
							</c:when>
							<c:when  test="${user.red == '否'}">
								<option value="否" selected>否</option>
								<option value="是">是</option>
							</c:when>
							<c:otherwise>
								<option value="" selected></option>
								<option value="否">否</option>
								<option value="是">是</option>
							</c:otherwise>
						</c:choose>
					</select>
				</div>
			</div>
			<div class="row cl">
				<label style="text-align: right;" class="form-label col-xs-4 col-sm-3">性别：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<select style="width: 190px;" class="select" size="1" name="sex">
						<c:choose>
							<c:when  test="${user.sex == '男'}">
								<option value="男" selected>男</option>
								<option value="女">女</option>
							</c:when>
							<c:when  test="${user.sex == '女'}">
								<option value="女" selected>女</option>
								<option value="男">男</option>
							</c:when>
							<c:otherwise>
								<option value="" selected></option>
								<option value="女">女</option>
								<option value="男">男</option>
							</c:otherwise>
						</c:choose>
					</select>
				</div>
			</div>
			<div class="row cl">
				<label style="text-align: right;" class="form-label col-xs-4 col-sm-3">邮箱：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input style="width: 190px;" type="text" style="width: 400px;" class="input-text" value="${user.email}" placeholder="" id="email" name="email">
				</div>
			</div>
			<div class="row cl">
				<label style="text-align: right;" class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>原密码：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input style="width: 190px;" type="text" style="width: 400px;" class="input-text" placeholder="" id="password" name="password">
				</div>
			</div>
			<div class="row cl">
				<label style="text-align: right;" class="form-label col-xs-4 col-sm-3">修改密码：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input style="width: 190px;" type="text" style="width: 400px;" class="input-text" placeholder="" id="rpassword" name="rpassword">
				</div>
			</div>
		</c:if>
		<c:if test="${type == '02'}">
			<div class="row cl">
				<label style="text-align: right;" class="form-label col-xs-4 col-sm-3">真实姓名：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input style="width: 190px;" type="text" style="width: 400px;" class="input-text" value="${admin.realname}" placeholder="" id="realname1" name="realname">
				</div>
			</div>
			<div class="row cl">
				<label style="text-align: right;" class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户名：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input style="width: 190px;" disabled type="text" style="width: 400px;" class="input-text" value="${admin.username}" placeholder="" id="username1" name="username">
					<input type="hidden" style="width: 400px;" value="${admin.id}"  name="id">
					<input type="hidden" style="width: 400px;" value="${admin.username}"  name="username">
				</div>
			</div>
			<div class="row cl">
				<label style="text-align: right;" class="form-label col-xs-4 col-sm-3">手机：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input style="width: 190px;" type="text" style="width: 400px;" class="input-text" value="${admin.phone}" placeholder="" id="phone1" name="phone">
				</div>
			</div>
			<div class="row cl">
				<label style="text-align: right;" class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>原密码：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input style="width: 190px;" type="text" style="width: 400px;" class="input-text" placeholder="" id="password1" name="password">
				</div>
			</div>
			<div class="row cl">
				<label style="text-align: right;" class="form-label col-xs-4 col-sm-3">修改密码：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input style="width: 190px;" type="text" style="width: 400px;" class="input-text" placeholder="" id="rpassword1" name="rpassword">
				</div>
			</div>
		</c:if>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
				<button class="btn btn-primary radius" onclick="sub()"><i class="Hui-iconfont">&#xe632;</i> 保存并提交审核</button>
				<button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
			</div>
		</div>
	</form>
</div>



<!--_footer 作为公共模版分离出去--> 
<script type="text/javascript" src="<%=path%>/static/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="<%=path%>/static/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="<%=path%>/static/static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="<%=path%>/static/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="<%=path%>/static/lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="<%=path%>/static/lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="<%=path%>/static/lib/jquery.validation/1.14.0/messages_zh.js"></script> 
<script type="text/javascript">
function save(){
	alert("刷新父级的时候会自动关闭弹层。")
	window.parent.location.reload();
}



function sub() {
	$.ajax({
		//几个参数需要注意一下
		type: "POST",//方法类型
		dataType: "json",//预期服务器返回的数据类型
		url: "<%=path%>/index/updateInfo/${type}" ,//url
		data: $('#formEdit').serialize(),
		success: function (result) {
			if (result == 202) {
				layer.msg('用户身份过期，请重新登录', {icon: 2, time: 3000});
			};
			if (result == 201) {
				layer.msg('原密码错误', {icon: 2, time: 3000});
			};
			if (result == 200) {
				layer.msg('修改成功，请退出后重新登录', {icon: 1, time: 5000});
			};
			if (result == 203) {
				layer.msg('请填写用户名，学号或密码', {icon: 2, time: 5000});
			};
			if (result == 204) {
				layer.msg('手机号格式错误', {icon: 2, time: 5000});
			};
			if (result == 205) {
				layer.msg('邮箱格式错误', {icon: 2, time: 5000});
			};
		},
		error : function() {
			alert("异常！");
		}
	});
}


// 手机号码验证
jQuery.validator.addMethod("isMobile", function(value, element) {
	var length = value.length;
	var mobile = /^(13[0-9]{9})|(18[0-9]{9})|(14[0-9]{9})|(17[0-9]{9})|(15[0-9]{9})$/;
	return this.optional(element) || (length == 11 && mobile.test(value));
}, "请正确填写您的手机号码");

$().ready(function() {
	$("#formEdit").validate({
		rules: {
			username: "required",
			password: {
				required: true
			}
		},
		messages: {
			username: "请输入用户名",
			password: {
				required: "请输入密码"
			}
		}
	});
});


</script>
<style>
    label.error{
        position: absolute;
        right: 25px !important;
        top: 5px;
        color: #ef392b;
        font-size: 12px;
    }
</style>
</body>
</html>